<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>找到所有数组中消失的数字</title>
</head>

<body>

</body>
<script>
    let arr = [1, 2, 3, 1, 1, 1, 2, 2, 3, 3, 4];

    
    let newArr = arr.reduce(function (pre, cur) {
        if (cur in pre) {
            pre[cur] += 1;
        } else {
            pre[cur] = 1;
        }
        return pre;

    }, {})
    
    for (let key in newArr) {
        console.log(key + '出现次数' + newArr[key]);
    }
</script>

</html>